# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-26
# @File : Files_to_json.py

import os
import time
import json


def write_file_data(data_dict, sku_id, item_name):
    '''
    :param data_dict: 网站字节数据
    :param sku_id: 商品id
    :param item_name: 项目名称
    :return:
    '''
    times = time.strftime("%Y%m%d-%H-%M-%S")
    if not os.path.exists("F:/Pychram_APP_Android/Utils/logs/{}".format(item_name)):
        os.mkdir("F:/Pychram_APP_Android/Utils/logs/{}".format(item_name))
    content_path_name = "F:/Pychram_APP_Android/Utils/logs/{}/{}_{}_content.json".format(item_name, times, sku_id)
    print("————————————数据获取中，请稍等————————————")
    with open(content_path_name, 'w') as f:
        f.write(json.dumps(data_dict.text))
